AddSaleOrderWindowCreator = Ext.extend(Ext.app.Module, {
	id : 'addSaleOrderWindowCreator',
	type : 'common/notepad',
	
	win_index : 1,
	
	init : function() {
//		this.ordersName = '非在线销售订单' || '在线销售订单';
	},
	getTypeWindow : function() {
		return AddSaleOrderWindow;
	},
	createWindow : function(initParams) {
		var desktop = this.app.getDesktop();

		var init_sellerCode = initParams.init_sellerCode ? initParams.init_sellerCode : '';
		
		var flag = false;
		
		desktop.windows.each(function(win) {
//			alert(init_sellerCode);
			if(win.creator && win.creator == this) {
				if(win.creator.ordersNameEn + win.sellerCode == this.ordersNameEn + init_sellerCode) {
					win.show();
					flag = true;
				}
			}
		}.createDelegate(this));
		
		if (flag) {
			return;
		}
		
		var versionCode = ++(PurchaseCount.count);
		
		this.typeWindow = this.getTypeWindow();
		
		var main_win = desktop.createWindow({
			sellerCode : init_sellerCode,
			title : this.ordersName + init_sellerCode,
			width : 1020,
			height : 535,
			iconCls : 'acc-icon',
			animCollapse : true,
            constrainHeader : true,
            maximizable : true,
			taskbuttonTooltip : this.ordersName,
			layout : "fit",
			items : []
		}, this.typeWindow);
		
		main_win.creator = this;
		main_win.versionCode = versionCode;
		main_win.initPanel(initParams);
		
		main_win.creatorIndex = this.win_index;
		
		this[this.win_index++] = main_win;
		
		main_win.show();
	}
});